<?php

    #-------------------------------------------------------------#
	# This file is part of the Tekuna MVC Microframework for PHP. #
	# (c) 2009 Niels Jäckel <niels.jaeckel@tekuna.org>            #
	# Please visit http://tekuna.org/ for more information.       #
	#                                                             #
	# This software is licensed under the MIT License. Please     #
	# view the LICENSE file for the full text of this license.    #
    #-------------------------------------------------------------#


	Tekuna :: load('org.tekuna.core.filter.TekunaFilter');


	/**
	 * This filter removes all those characters that may not appear
	 * within a valid URL. The following characters are considered as
	 * valid URL characters:
	 *
	 *   - a-z
	 *   - A-Z
	 *   - 0-9
	 *   - ,
	 *   - .
	 *   - ;
	 *   - !
	 *   - -
	 *   - _
	 *   - /
	 *   - #
	 */

	class URLCharsFilter implements TekunaFilter {


		/**
		 * Removes all characters that are no valid URL characters
		 *
		 * @param mixex $mInput
		 * @return string
		 */

		public function filter($mInput) {

			return preg_replace('~[^a-zA-Z0-9,\.:;!\-_/#\?\&%=@]~', '', $mInput);
		}
	}
